
import { inject, observer } from 'mobx-react';
import React from 'react';
import TestStore from '../../store/testStore';
import'./index.less'

interface IHomeState {
  num: number
}

@inject('testStore')
@observer
class Home extends React.Component<{}&{testStore: TestStore}, IHomeState> {

  constructor(props: {}&{testStore: TestStore}) {
    super(props);
    this.state = {
      num: 0
    }
  }
  
  componentDidMount() {
    console.log(this.props.testStore.title)
    
  }
  oncliskimg() {
    this.props.testStore.setTitle('kjsn'+this.state.num);
    const num = this.state.num+1
    this.setState({
      num,
    })
  }

  render() {
    return (
      <div className="Home">
        {this.props.testStore.title}1wwaa
        <div 
          className="artLogo" 
          onClick={() => this.oncliskimg()}
        >
          <img alt="" src="https://yit-prod.oss-cn-hangzhou.aliyuncs.com/xcx/art/20210402_artlogo.png" />
        </div>
      </div>
    )
  }
}


export default Home